<?php 
session_start();
include "biblioteca/funcao.php";

$sql_busca = "SELECT * FROM cliente";
$res_busca = sql($sql_busca);
$i = 0;
while($linha = mysql_fetch_array($res_busca)){
    
    if ($linha['cli_code'] != "") {
    
        if ($i == 0) { 

            $code[] = $linha['cli_code']; 

        } else { 

            if (in_array($linha['cli_code'],$code)) {

                $sql2 = "DELETE FROM cliente WHERE cli_id='{$linha['cli_id']}'";    
                sql($sql2); 
                
                // inserir manning
                echo $sql2."<br><hr>";

            } else {

                $code[] = $linha['cli_code']; 

            }

        }

        
        
    }
    
    $i++;

}
